package com.mxwl.cbg.common.model.source.role;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
@Schema(description = "角色身上的法宝（包括灵宝、法宝）")
public class FaBao {
    /// 法宝的数据来自fabao字段
    //已装备
    @Schema(description = "已装备的法宝")
    private List<Cimelia> using_fabao = new ArrayList<>();
    //未装备
    @Schema(description = "未装备的法宝")
    private List<Cimelia> nousing_fabao = new ArrayList<>();

    /// 灵宝的数据来自lingbao字段
    @Schema(description = "已装备的灵宝")
    private List<Cimelia> using_lingbao = new ArrayList<>();
    @Schema(description = "未装备的灵宝")
    private List<Cimelia> nousing_lingbao = new ArrayList<>();

    public void addFaBao(Cimelia cimelia, int pos) {
        if (pos >= 1 && pos <= 4) {
            using_fabao.add(cimelia);
        } else {
            nousing_fabao.add(cimelia);
        }
    }

    public void addLingBao(Cimelia cimelia, int pos) {
        if (pos >= 1 && pos <= 2) {
            using_lingbao.add(cimelia);
        } else {
            nousing_lingbao.add(cimelia);
        }
    }

    @Data
    @Schema(description = "法宝、灵宝的公用数据模型")
    public static class Cimelia {
        @Schema(description = "法宝的数据说明")
        private String cDesc;
        @Schema(description = "法宝的编号")
        private Integer iType;
    }
}
